<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<div class="line-big">
	<div class="xl12">
		<div class="panel border-back">
			<div class="panel-foot bg-yellow-light border-back">
				<div class="line-big">
					<div class="xl3 text-center border-small border-right border-blue">管理员信息</div>
					<div class="xl6 text-center border-small border-right border-blue">管理员功能模块</div>
					<div class="xl1 text-center border-small border-right border-blue">添加时间</div>
					<div class="xl2 text-center">操作</div>
				</div>
			</div>
			<ul class="list-group list-striped">
				<c:forEach items="${managerViewList}" var="mv">
					<li id="li_${mv.manager.managerName }">
						<div class="line-big">
							<div class="xl3 text-left">
								<h4>
									<strong>${mv.manager.managerName }</strong>
								</h4>
								<h6>密码:${mv.manager.managerPassword }</h6>
								<h6>邮箱:${mv.manager.managerEmail }</h6>
								<h6>真实姓名:${mv.manager.managerRealName }</h6>
							</div>
							<div class="xl6 text-left module_name_text_div">
								<c:forEach items="${mv.managerModuleList }" var="module">
									<span data-id="${module.moduleName }" class="G-MarginRight5"></span>
								</c:forEach>
							</div>
							<div class="xl1 text-center">
								<h6>
									<fmt:formatDate value="${mv.manager.managerAddTime}" pattern="yyyy-MM-dd HH:mm" />
								</h6>
							</div>
							<div class="xl2 text-center">
								<button class="manager_need_update_button button button-little bg-blue" data-id="${mv.manager.managerName }">
									<span class="icon-pencil"></span> 修改
								</button>
								<button class="manager_need_delete_button button button-little bg-red" data-id="${mv.manager.managerName }" data-li="#li_${mv.manager.managerName }">
									<span class="icon-trash-o"></span> 删除
								</button>
							</div>
						</div>
					</li>
				</c:forEach>
			</ul>
		</div>
	</div>
</div>
<div class="clearfix G-MarginTop100"></div>
<div style="display: none;" id="k" data-value="${param.k }"></div>
<div id="see_article_detail"></div>
<script type="text/javascript" src="js/pintuer.js"></script>
<script type="text/javascript">
	$(function()
	{

		$(".module_name_text_div").find("span").each(function(index, domEle)
		{
			var obj = $(domEle);
			obj.text($("#module_name_list_div").find("span[data-id='" + obj.attr("data-id") + "']").attr("data-text"));
		});

		$(".manager_need_update_button").click(function()
		{
			$("#admin_div").load("shop/shop_update_manager?id=" + $(this).attr("data-id"), {}, function()
			{

			});
		});

		$(".manager_need_delete_button").each(function()
		{
			$(this).click(function()
			{
				if (confirm("确认删除此管理员吗?") == false)
				{
					return false;
				}
				var ids = "";
				ids = $(this).attr("data-id");
				var obj = $(this);

				obj.attr("disabled", "disabled");
				$.post("admin/m_delete_manager_do",
				{
					"commonStr" : ids
				}, function(json)
				{
					if (json.success == false)
					{
						alert(json.info);
						obj.removeAttr("disabled");
						toastr.error(json.info, '操作失败!');
					}
					else
					{
						obj.removeAttr("disabled");
						$(obj.attr("data-li")).remove();
						toastr.success('操作成功了!');
					}
				},
				//返回类型
				"json");
			});
		});

	});
</script>